<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<script>
var img;
var jsTestIsAsync = true;

if (window.internals)
    internals.evictAllResources();

window.addEventListener("message", function() {
        if (window.internals) {
            shouldBeFalse('internals.isLoadingFromMemoryCache("resources/image-set-4x.png")');
            shouldBeTrue('internals.isLoadingFromMemoryCache("resources/blue_rect.jpg")');
        }
        finishJSTest();
    });
</script>

<iframe id="frame" style="width: 80px;"></iframe>
<script>
var iframe = document.getElementById('frame');
var iframeDoc = iframe.contentWindow.document;

iframeDoc.body.innerHTML = '<img id="srcset" srcset="resources/blue_rect.jpg 90w, resources/image-set-4x.png 120w">';
var img = iframeDoc.getElementById('srcset');
img.onload = function() {
    window.parent.postMessage("loaded", "*");
};
</script>
